import request from '@/utils/request'

// 获取文件列表
export const apiGetList = (belongModule, params, loading) => {
  return request({
    url: `/${belongModule}/fileController/listFiles`,
    method: 'get',
    params,
    resField: 'data',
    loading,
  })
}
// 文件密级
export const apiGetSecretList = (busCode) => {
  return request({
    url: '/obj/enumTypeController/listMySecret?busCode=' + busCode,
    method: 'get',
    resField: 'data',
  })
}

// 删除文件
export const apiDel = (belongModule, ids) => {
  return request({
    url: `/${belongModule}/fileController/${ids}`,
    method: 'delete',
  })
}
// 文件下载
export const apiDown = (belongModule, id, loading) => {
  return request({
    url: `/${belongModule}/fileController/listPreviewUrl?ids=${id}`,
    method: 'get',
    loading,
    resField: 'data',
  })
}

// 编辑除文件外的属性，例如密级和用途
export const apiEditOther = (belongModule, data) => {
  return request({
    url: `/${belongModule}/fileController/updateFileInfos`,
    method: 'post',
    data,
    resField: 'data',
  })
}
